<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<style>
  * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }

  @font-face {
    font-family: "Seurat";
    src: url("https://assets.codepen.io/4175254/FOT-Seurat+Pro+DB.otf") format("opentype");
  }

  body {
    display: flex;
    justify-content: center;
    align-items: center;
    column-gap: 12px;
    min-height: 100vh;
    font-family: "Seurat", sans-serif;
  }

  .button {
    all: unset;
    display: flex;
    justify-content: center;
    align-items: center;
    column-gap: 0.5em;
    position: relative;
    border-radius: 50px;
    padding: 16px 24px;
    background-color: #f0f7fa;
    box-shadow: inset 0 -4px 8px #87bfd8, 0 4px 6px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    color: #0470e3;
    transition: transform 0.4s cubic-bezier(0.55, 1, 0.15, 1);
    will-change: transform;
  }

  .button:active {
    transform: scale(0.92);
  }

  .button:active::after {
    opacity: 1;
  }

  .button::after {
    content: "";
    position: absolute;
    inset: 0;
    border-image-source: url("https://assets.codepen.io/4175254/mario-button-borders.png");
    border-image-slice: 50%;
    border-image-width: 40px;
    border-style: solid;
    transform: scale(1.04, 1.08);
    opacity: 0;
    transition-property: opacity;
    transition-duration: 0.4s;
    transition-timing-function: cubic-bezier(0.55, 1, 0.15, 1);
    will-change: transform;
  }

  .button:focus-visible::after {
    opacity: 1;
    animation: pulsate 1s infinite;
  }

  .button-image {
    width: 1.75em;
    height: 1.75em;
    object-fit: contain;
  }

  @keyframes pulsate {
    0% {
      transform: scale(1.04, 1.08);
    }

    50% {
      transform: scale(1.08, 1.12);
    }

    100% {
      transform: scale(1.04, 1.08);
    }
  }
</style>

<body>
  <button class="button" type="button">
    <img class="button-image" src="https://assets.codepen.io/4175254/mario.png" alt="" />
    <span>Mario</span>
  </button>
  <button class="button" type="button">
    <img class="button-image" src="https://assets.codepen.io/4175254/luigi.png" alt="" />
    <span>Luigi</span>
  </button>
</body>

</html>